<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-16" />
<meta name="description" content="description" />
<meta name="keywords" content="keywords" />
<meta name="author" content="author" />
<link rel="stylesheet" type="text/css" href="default.css" media="screen" />
<title>Skill Management</title>
<script language="JavaScript" type="text/javascript">
<!--
var num=1;
function accoda(){
	if(document.createElement && document.getElementById && document.getElementsByTagName) {
		// crea elementi
		var oTr=document.createElement("TR");
		var oTd1=document.createElement("TD");
		var oTd2=document.createElement("TD");
		var oTd3=document.createElement("TD");
		var oField=document.createElement("SELECT");
		var oField1=document.createElement("SELECT");
		var oButt=document.createElement("INPUT");

		oField.name="parent"+num;
		oField1.name="level"+num;
		<%
		java.util.Vector trees = (java.util.Vector) session.getAttribute("taxonomy");
		for (int i = 0; i < trees.size(); i++) {
			String spcs = "+";
			common.MyNode n = (common.MyNode) trees.get(i);
			for (int j = 0; j < n.depth; j++)
				spcs += "-";
			String v = (String) (spcs + n.child.getLocalName());%>
			oField.options['<%=i%>']=new Option('',escape('<%=n.child.getLocalName()%>'),false,false);
			oField.options['<%=i%>'].innerHTML = '<%=v%>';
		<%}%>

		
		// setta attributi
		oField1.options[0]=new Option('',escape('1'),false,false);
		oField1.options[0].innerHTML = '1';
		oField1.options[1]=new Option('',escape('2'),false,false);
		oField1.options[1].innerHTML = '2';
		oField1.options[2]=new Option('',escape('3'),false,false);
		oField1.options[2].innerHTML = '3';
		oField1.options[3]=new Option('',escape('4'),false,false);
		oField1.options[3].innerHTML = '4';
		oField1.options[4]=new Option('',escape('5'),false,false);
		oField1.options[4].innerHTML = '5';

		oButt.setAttribute("type","button");
		oButt.setAttribute("value","rimuovi");

		// setta gestore evento
		if(oButt.attachEvent) oButt.attachEvent('onclick',function(e){rimuovi(e);})
		else if(oButt.addEventListener) oButt.addEventListener('click',function(e){rimuovi(e);},false)

		// appendi al relativo padre
		oTd1.appendChild(oField);
		oTd2.appendChild(oButt);
		oTd3.appendChild(oField1);
		oTr.appendChild(oTd1);
		oTr.appendChild(oTd3);
		oTr.appendChild(oTd2);
		document.getElementById('tabella').getElementsByTagName('TBODY')[0].appendChild(oTr);

		// incrementa variabile globale
		num++
	}
}


function rimuovi(e){
	if(document.removeChild && document.getElementById && document.getElementsByTagName) {
		if(!e) e=window.event;
		var srg=(e.target)?e.target:e.srcElement;

		// risali al tr del td che contiene l' elemento che ha scatenato l' evento
		while(srg.tagName!="TR"){srg=(srg.parentNode)?srg.parentNode:srg.parentElement}

		// riferimento al tbody
		var tb=document.getElementById('tabella').getElementsByTagName('TBODY')[0];
		
		// rimuovi
		tb.removeChild(srg);
	}
}
//-->
</script>
</head>

<body>

<div class="outer-container">

<div class="inner-container">

<div class="header">

<div class="title"><span class="sitename"><a
	href="index.jsp">Skill Management</a></span>
<div class="slogan">Sistemi ad Agenti</div>

</div>

</div>

<div class="path"><a href="index.jsp">Home</a> &#8250; <a
	href="intermediario.php">Inserimento Instanza</a></div>

<div class="main">

<div class="content">
<h2>Inserimento di una nuovo utente</h2>
<p />
<p />
<form name="modulo" method="post"
	action="/skillManagement/insertInstance">
File:
<input type="text" name="login" />
<p />
Nome soggetto:
<input type="text" name="nome" />

<table border="1" id="tabella">
	<tbody>
		<tr>
			<td><select name="parent0">
				<%
					java.util.Vector tree = (java.util.Vector) session
							.getAttribute("taxonomy");
				%>
				<%
					for (int i = 0; i < tree.size(); i++) {
						String spcs = "+";
						common.MyNode n = (common.MyNode) tree.get(i);
						for (int j = 0; j < n.depth; j++)
							spcs += "-";
						String v = (String) (spcs + n.child.getLocalName());
				%>
				<option value="<%=n.child.getLocalName()%>"><%=v%></option>
				<%
					}
				%>
			</select></td>
			<td><select name="level0">
				<option value="1">1</option>
				<option value="2">2</option>
				<option value="3">3</option>
				<option value="4">4</option>
				<option value="5">5</option>
			</select></td>
			<td><input type="button" disabled="disabled" value="rimuovi" /></td>
		</tr>
	</tbody>
</table>
<input type="button" value="accoda" onclick="accoda()" />
<input type="submit" name="conferma" value="conferma">
</form>
</div>

<div class="navigation">

<h2>Menu</h2>
<?php
include("menu.php");
?></div>

<div class="clearer">&nbsp;</div>

</div>

<div class="footer"><span class="left"> &copy; 2007 <a
	href="index.jsp">Website.com</a>. Valid <a
	href="http://jigsaw.w3.org/css-validator/check/referer">CSS</a> &amp; <a
	href="http://validator.w3.org/check?uri=referer">XHTML</a> </span> <span
	class="right"> <a href="http://templates.arcsin.se">Website
template</a> by <a href="http://arcsin.se">Arcsin</a> </span>

<div class="clearer"></div>

</div>

</div>

</div>

</body>

</html>